package com.example.bgxqmanage.feign;

import com.example.bgxqapi.util.LogUtil;
import com.example.bgxqapi.util.UserUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

/**
 *   为feign调用增加请求头
 * @author lizijian
 */
@Component
public class FeignRequestInterceptor implements RequestInterceptor {

  @Override
  public void apply(RequestTemplate requestTemplate) {
    requestTemplate.header("task_id",LogUtil.getTaskId());
    requestTemplate.header("token", UserUtil.getToken());
  }
}
